﻿using System.Collections.Generic;
using System.Linq;

namespace PerfectNumber
{
    public class Solution
    {
        public bool CheckPerfectNumber(int num)
        {
            if (num <= 1) 
            {
                return false;
            }

            var factors = new List<int>() { 1 };
            for (int i = 2; i <= num / 2; i++)
            {
                if (num % i == 0)
                {
                    factors.Add(i);
                }
            }

            return factors.Sum() == num;
        }
    }
}
